package com.pzh.vue.exception;

import com.pzh.vue.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public Object handle(ServiceException e){
       return Result.error(e.getCode(),e.getMsg());
    }
}
